package com.wokeMy.view.channe.tongfutong;


import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.woke.method.MyApp;
import com.wokeMy.view.base.BaseActivity;
import com.wokeMy.view.model.GhtZd;
import com.wokeMy.view.util.Util;
import com.zhongcai.online.R;


public class DetailTftActivity extends BaseActivity {



    private TextView detailtitle;
    private ImageView detailback;
    private TextView detailname;
    private TextView detailzfcard;
    private TextView detailmomey;
    private TextView detailfate;
    private TextView detailstate;
    private TextView detailtime;
    private TextView detailshoucard;
    private TextView detaildaomomey;
    GhtZd ghtZd;
    String user_id;
    int way_id;
    @Override
    public void setContentView() {
        setContentView(R.layout.activity_detail_dh);

    }

    @Override
    public void initView() {
        this.detailtime = (TextView) findViewById(R.id.detail_time);
        this.detailstate = (TextView) findViewById(R.id.detail_state);
        this.detailfate = (TextView) findViewById(R.id.detail_fate);
        this.detailmomey = (TextView) findViewById(R.id.detail_momey);
        this.detaildaomomey = (TextView) findViewById(R.id.detail_daomomey);
        this.detailzfcard = (TextView) findViewById(R.id.detail_zfcard);
        this.detailshoucard = (TextView) findViewById(R.id.detail_shoucard);
        this.detailname = (TextView) findViewById(R.id.detail_name);
        this.detailback = (ImageView) findViewById(R.id.detail_back);
        this.detailtitle = (TextView) findViewById(R.id.detail_title);
    }

    @Override
    public void initData() {
        ghtZd = (GhtZd)getIntent().getSerializableExtra("detail");
        user_id=((MyApp)getApplication()).getDatas_load().getId();
        way_id = getIntent().getIntExtra ("way_id", 0);
        Log.e("DetailDhActivity",way_id+"");
    }

    @Override
    public void initActivity() {
        detailtime.setText(Util.getStrTi(ghtZd.getCreate_time()));
        String tip;
        switch (ghtZd.getStatus()) {
            case "S":
                tip="到账成功";
                break;
            case "F":
                tip="处理中";
                break;
            case "W":
                tip="交易失败";
                break;
            default:
                tip="交易失败";
                break;
        }
        detailstate.setText(tip);
        detailfate.setText(Float.valueOf(ghtZd.getRate())*100+"%+"+ghtZd.getFee());
        detailmomey.setText(Util.twoString(ghtZd.getAmount())+"元");
        detaildaomomey.setText(Util.twoString(ghtZd.getCurr_money())+"元");
        detailtitle.setText("快捷详情");
        detailzfcard.setText(ghtZd.getCard_no().substring(0, 4)+"    "+"***"+"    "+"***"+"    "+"***"+"    "+ghtZd.getCard_no().substring(ghtZd.getCard_no().length()-3,ghtZd.getCard_no().length()));
        detailshoucard.setText(ghtZd.getOther_card_no().substring(0, 4)+"    "+"***"+"    "+"***"+"    "+"***"+"    "+ghtZd.getOther_card_no().substring(ghtZd.getOther_card_no().length()-3,ghtZd.getOther_card_no().length()));
        MyApp application = (MyApp) getApplication();
        detailname.setText(application.getDatas_load().getUser_nicename());
        Log.e("快捷详情",ghtZd.toString());
        detailback.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

}
